<?php echo $left ?>
<style type="text/css">
    td{
        cursor:default;
    }


    #page{height:32px;line-height:32px;margin-top:15px;margin-bottom:15px;text-align:left;margin-left: 16px}
    #page a{background:#fff;border-radius:5px;float:left;display:block;padding:0 12px;line-height:32px;border:1px solid #ddd;margin-right:5px;font-size:12px;font-weight:bold;color:#444;}
    #page a:hover{background:#f6f6f6}
    #page a.cur{color:red;background:#444;border:1px solid #444;color:#fff;}
    #page a.noborder{border:none;margin:0 2px;}


</style>
<script>
$( document ).ready(function() {
	$.ajaxSetup({
		cache: false
	});
	$( '.sidebar' ).simpleSidebar({
		settings: {
			opener: '#open-sb',
			wrapper: '.wrapper',
			animation: {
				duration:0,
				easing: 'easeOutQuint'
			}
		},
		sidebar: {
			align: 'left',
			width: 214,
			closingLinks: 'a',
		}
	});
});
</script>

<div class="clear"></div>
<div  class="w640">
      <div class="yd3 pt50"><span class="ydtxt">公益收益中心</span> - 团队合作记录</div>
	  <table cellpadding="0" cellspacing="0" class="liebiao">
	     <tr>
		    <th>公益<br />编号</th>
            <th>姓名</th>
			<th>合作<br />金额</th>
			<th>合作<br />时间</th>
			<th>状态</th>
             <th>合作接单</th>
			<th>推广人<br />账号</th>
             <th>推广人<br />姓名</th>
	     </tr>
		<?php foreach($data_list as $key => $datalist){ ?>
            <tr class="er">
                <td><?php echo $datalist['user_account'] ?></td>
                <td><?php echo $datalist['user_name'] ?></td>
                <td><?php echo $datalist['money'] ?></td>
                <td><?php  if($datalist['pipei_time'] != 0):?>
                        <?php echo date('Y-m-d H:i:s',$datalist['pipei_time']) ?>
                    <?php else: ?>
                        未匹配
                    <?php endif; ?>
                </td>
                <td class="chakan">
                    <?php $wait_time = 0; $has_time =  0; ?>

                    <?php if($datalist['pay_status'] == 2):?>
                        拒绝打款<br>
                        <?php

                        $wait_time = 0;
                        $has_time = 14400 - ( time() - $datalist['pay_time']);
                        if($has_time > 0){
                            echo "接单倒计时：";
                        }
                        ?>
                    <?php elseif($datalist['dakuan'] == 1 && $datalist['shoukuan'] == '0'):?>
                        匹配， 已打款<br>
                    <?php elseif($datalist['pay_status'] == 0 && $datalist['pipei_time'] != 0): ?>
                        匹配，未打款<br>
                        <?php
                        //echo date('Y-m-d H:i:s',$datalist['pipei_time']);

                        $atime = time() - $datalist['pipei_time'];

                        if($atime < 86400){
                            //等待时间
                            $wait_time = 86400 - $atime;
                            //接单时间
                            $has_time = 0;
                        }else{

                            $has_time = 0;

                            $has_time = 86400 + 14400 - $atime;
                        }


                        ?>
                    <?php elseif($datalist['pay_status'] == 1 && $datalist['shoukuan'] == '1'):?>
                        匹配， 已确认收款<br>

                    <?php else: ?>
                        未匹配
                    <?php endif; ?>
                    <?php
                    if($wait_time > 0){
                        $str_time = $wait_time;
                    }else if($has_time > 0){
                        $str_time = $has_time;
                    }else{
                        $str_time = 0;
                    }
                    //echo $str_time;
                    if($str_time > 0){
                        echo '<span class="settime" endTime="'.$str_time .'"></span>';
                    }else{
                        echo '';
                    }
                    ?>
                </td>
                <td>
                    <?php if($datalist['up_user_id'] == -1): ?>
                        <?php echo '已拒绝' ?>
                    <?php elseif( ($datalist['pay_status'] == 2 && $has_time > 0) ||  ($datalist['pay_status'] == 0 && $has_time >0) ): ?>
                        <?php if($user['user_account'] == $datalist['up_account']): ?>
                            <p class="btn_on"><a href="<?php echo site_url('team_log/info_post/1/').$datalist['id'] .'/'.$user['id'].'/'.$datalist['money']?>">接单</a></p>
                            <p class="btn_off"><a href="<?php echo site_url('team_log/info_post/-1/').$datalist['id'] .'/'.$user['id'].'/'.$datalist['money']?>">拒绝</a></p>
                        <?php endif; ?>
                    <?php elseif(($datalist['pay_status'] == 2 && $has_time < 0) ||  ($datalist['pay_status'] == 0 && $has_time <0)): ?>
                        <?php echo '过期'; ?>
                    <?php endif; ?>
                </td>
                <td><?php echo $datalist['up_account'] ?></td>
                <td><?php echo $datalist['up_name'] ?></td>
            </tr>
                                <?php } ?>
	</table>
	<?php echo $multi;?>
</div>
<script type="text/javascript">
 var intDiff = parseInt(86400);//倒计时总秒数量
    <?php foreach($data_list as $key => $datalist){ ?>
	function timer<?=$key?>(intDiff){
        window.setInterval(function(){
            var hour=0,
                minute=0,
                second=0;//时间默认值
            if(intDiff > 0){
                hour = Math.floor(intDiff / (60 * 60));
                minute = Math.floor(intDiff / 60)  - (hour * 60);
                second = Math.floor(intDiff) - (hour * 60 * 60) - (minute * 60);
            }
            if (minute <= 9) minute = '0' + minute;
            if (second <= 9) second = '0' + second;
            $('#hour_show<?=$key?>').html(hour+':');
            $('#minute_show<?=$key?>').html(minute+':');
            $('#second_show<?=$key?>').html(second);
            intDiff--;
        }, 1000);
    }
	<?php } ?>
    $(function(){
		<?php foreach($data_list as $key => $datalist){ ?>
        timer<?=$key?>(intDiff);
		<?php } ?>
    });
</script>
<?php echo $foot; ?>